<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

	<ui:composition template="template.xhtml">
	<ui:define name="corpo-da-pagina">
		<h:form >
		
		<p:dataTable id="dataTable" var="auto" value="#{automovelBean.autos}" rows="5" paginator="true" rowKey="#{auto.idautomovel}"
			selection="#{automovelBean.autosSelecionados}" selectionMode="multiple" sortMode="simple">  
        
        <f:facet name="header">  
            Tabela Automóveis 
        </f:facet>  
  
        <p:column sortBy="#{auto.idautomovel}" filterBy="#{auto.idautomovel}" headerText="ID">  
        	<h:outputText value="#{auto.idautomovel}" /> 
        </p:column>  
  
        <p:column sortBy="#{auto.modelo.descricao}" filterBy="#{auto.modelo.descricao}" headerText="Modelo">
        	<h:outputText value="#{auto.modelo.descricao}" />
	        
        </p:column>  
  
        <p:column sortBy="#{auto.modelo.marca.descricao}" filterBy="#{auto.modelo.marca.descricao}" headerText="Marca">  
            <h:outputText value="#{auto.modelo.marca.descricao}" />  
        </p:column>  
  
        <p:column sortBy="#{auto.anoFabricacao}" filterBy="#{auto.anoFabricacao}" headerText="Fabricação">  
            <h:outputText value="#{auto.anoFabricacao}" />  
        </p:column>
                 
        <f:facet name="footer">  
            <p:commandButton value="View" onclick="carDialog.show()"/>  
        </f:facet>   
    </p:dataTable> 
    
    	<p:dialog header="Car Detail" widgetVar="carDialog" width="250" showEffect="clip" hideEffect="clip">  
  
	        <h:panelGrid columns="2" cellpadding="5">  
  
            <h:outputLabel for="id" value="ID:" />  
            <p:inputText id="id" label="id" value=""  />  
              
            <h:outputLabel for="surname" value="Surname:" />  
            <p:inputText id="surname" label="surname" />  
                  
            <h:outputLabel for="telephone" value="Telephone:" />  
            <p:inputText id="telephone" label="telephone" />  
      
        </h:panelGrid>  
  
    	</p:dialog> 
    	  
		</h:form >
		
	
		</ui:define >
	</ui:composition>
</html>